const book = {
  state: {
    fileName: '',
    menuVisible: false,
    settingVisible: -1, // -1:不显示,0:字号,1:主题,2:进度,3:目录
    defaultFontSize: 16,
    defaultFontFamily: 'Default',
    fontFamilyVisible: false,
    defaultTheme: 'Default',
    bookAvailable: false,
    progress: 0,
    section: 0,
    isPaginating: true,
    currentBook: null,
    navigation: null,
    cover: null,
    metadata: null,
    paginate: '',
    pagelist: null,
    offsetY: 0,
    isBookmark: null
  },
  mutations: {
    // 可以这么写
    // 'SET_FILENAME': (state, fileName) => {
    //   state.fileName = fileName
    // }
    // 也可以这么写
    aSetFileName: (state, fileName) => {
      state.fileName = fileName
    },
    aSetMenuVisible: (state, menuVisible) => {
      state.menuVisible = menuVisible
    },
    aSetSettingVisible: (state, settingVisible) => {
      state.settingVisible = settingVisible
    },
    aSetDefaultFontSize: (state, defaultFontSize) => {
      state.defaultFontSize = defaultFontSize
    },
    aSetDefaultFontFamily: (state, font) => {
      state.defaultFontFamily = font
    },
    aSetFontFamilyVisible: (state, visible) => {
      state.fontFamilyVisible = visible
    },
    aSetDefaultTheme: (state, theme) => {
      state.defaultTheme = theme
    },
    aSetBookAvailable: (state, bookAvailable) => {
      state.bookAvailable = bookAvailable
    },
    aSetProgress: (state, progress) => {
      state.progress = progress
    },
    aSetSection: (state, section) => {
      state.section = section
    },
    aSetIsPaginating: (state, isPaginating) => {
      state.isPaginating = isPaginating
    },
    aSetCurrentBook: (state, currentBook) => {
      state.currentBook = currentBook
    },
    aSetNavigation: (state, navigation) => {
      state.navigation = navigation
    },
    aSetCover: (state, cover) => {
      state.cover = cover
    },
    aSetMetadata: (state, metadata) => {
      state.metadata = metadata
    },
    aSetPaginate: (state, paginate) => {
      state.paginate = paginate
    },
    aSetPagelist: (state, pagelist) => {
      state.pagelist = pagelist
    },
    aSetOffsetY: (state, offsetY) => {
      state.offsetY = offsetY
    },
    aSetIsBookmark: (state, isBookmark) => {
      state.isBookmark = isBookmark
    }
  }
  // 放入actions.js中
  // actions: {
  //   setFileName: ({ commit }, fileName) => {
  //     return commit('aSetFileName', fileName)
  //   },
  //   SetMenuVisible: ({ commit }, menuVisible) => {
  //     return commit('aSetMenuVisible', menuVisible)
  //   }
  // }
}

export default book
